<template>
    <div id="agreement" class='agreement'>
        <div class="title">{{ agreementTitle }}</div>
        <div class="content">
            <div v-for="(item, index) in contentList" :class="['items', indexList.includes(index + 1) ? 'mt-30' : '']"
                :key="item">
                {{ item }}
            </div>
        </div>
        <div class="party-a">
            <div class="ft">
                <span>甲方：方田教育</span>
            </div>
            <div class="date">
                <span>日期：</span>
                <span>{{ currentDay[0] }}</span>
                <span>年</span>
                <span>{{ currentDay[1] }}</span>
                <span>月</span>
                <span>{{ currentDay[2].split(" ")[0] }}</span>
                <span>日</span>
            </div>
            <img src="../../assets/img/agreement/seal.png" alt="" srcset="" />
        </div>
        <div class="party-b">
            <div class="ft">
                <div class="sign">
                    <span>乙方：</span>
                    <!-- v-show="!signature" -->
                    <!-- <span class="start-sign" v-show="!signature"></span> -->
                    <img :src="formInfo.signature" class="sign-img" alt="img" crossOrigin="anonymous" />
                </div>
            </div>
            <div class="date">
                <span>日期：</span>
                <span>{{ formInfo.joinTrainingTime[0] }}</span>
                <span>年</span>
                <span>{{ formInfo.joinTrainingTime[1] }}</span>
                <span>月</span>
                <span>{{ formInfo.joinTrainingTime[2] }}</span>
                <span>日</span>
            </div>
        </div>

        <van-back-top>
            <template #default>
                <img src="../../assets/img/toTop.png" class="back-to-top-img" alt="" srcset="" />
            </template>
        </van-back-top>
    </div>

</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue';

const clickStatus = JSON.parse(localStorage.getItem('clickStatus'));

const currentDay = ref(clickStatus.currentDay?.split("-") || "")

onMounted(() => {

});

// 签名照片
const signature = ref<string>('');
const formInfo = ref({
    name: clickStatus.userName,//姓名
    phoneNum: clickStatus.phone,//手机号
    addr: clickStatus.certificateType,//证件类型
    id: clickStatus.certificateNumber,//用户身份证
    picker: clickStatus.trainingTime,//培训日期
    signature: clickStatus.trainingUrl,//签字图片
    joinTrainingTime: clickStatus.joinTrainingTime?.split("-") || "",//签字日期
});
const agreementTitle = ref<string>('方田教育新田计划特训营培训协议');
const indexList = ref<number[]>([6, 9, 11, 13, 17, 21]);
const contentList = ref<string[]>([
    '甲方（提供培训方）：方田教育',
    `乙方（接受培训方）：${formInfo.value.name || '系统异常'}`,
    `联系方式：${formInfo.value.phoneNum || '系统异常'}`,
    `${formInfo.value.addr || '系统异常'}号码：${formInfo.value.id || '系统异常'}`,
    '为帮助乙方快速提升教学能力、掌握教师岗位必备工作技能，甲方特组织新田计划特训营，由甲方对乙方进行候选人教学能力培训，经甲、乙双方充分协商，自愿达成如下共识，特订立本协议，以资恪守。',
    '一、培训时间',
    `${formInfo.value.picker || '系统异常'}。`,
    '乙方逾期未参加培训视为乙方自动放弃，乙方若因不可抗力不能按期参加培训，另行协商解决。',
    '二、培训地点',
    '安徽省合肥市',
    '三、培训费用',
    '特训营期间课程及师资费用，交通住宿及餐饮均由甲方提供，不向乙方收取其他任何费用。',
    '四、甲方的权利和义务:',
    '4.1 甲方负责提供培训场地、设备设施、培训课程等用于开展培训；',
    '4.2 甲方设置培训内容、安排培训日程、组织培训活动、进行培训考核；',
    '4.3 甲方对乙方在培训活动之外的行为不承担责任。',
    '五、乙方的权利和义务',
    '5.1 培训期间，乙方须接受甲方的各项管理规定，遵守培训纪律，如有违反，甲方可对乙方提出劝退，提前结束对乙方的培训：',
    '5.2 乙方在培训期间未经甲方允许，不得私自外出，由此产生的一切后果及造成的任何安全事故、意外事件，均由乙方自行全部承担，与甲方无关，由此造成甲方相关损失的，由乙方全部承担，涉及到相关法律法规的，将追究其相关法律法规责任。',
    '5.3 甲方提供的内部教材、知识产权和软件系统等仅限培训期间乙方本人使用，未经甲方同意，乙方不得以任何形式或载于任何载体，以口头、图像或书面等方式向第三方披露。如违反此条款给甲方造成任何损失，乙方应承担赔偿责任。',
    '六、其他',
    '1.乙方若因自身原因放弃或中途退出培训，视为乙方自愿放弃参与新田计划特训营、自愿放弃候选人身份；',
    '2.本协议一式贰份，甲、乙双方各执壹份；',
    '3.本协议自甲乙双方签字盖章之日起生效，培训结束或乙方因故退出时，协议自动终止。',
    '4.本协议未尽事宜，甲、乙双方共同协商解决。',
]);

</script>

<style lang="less" scoped>
#agreement {
    width: 100vw;
    //overflow: auto;
    padding: 17px;
    box-sizing: border-box;
    background: #fff;
    color: #333;
    padding-top: 60px;
}

.title {
    width: 100%;
    height: 40px;
    opacity: 1;
    font-size: 18px;
    font-weight: normal;
    line-height: 25px;
    text-align: center;
    letter-spacing: 0em;
    font-variation-settings: 'opsz' auto;
    color: #212121;
}

.content {
    line-height: 30px;
    font-size: 16px;
    .items {
        margin-top: 5px;
    }
}

.mt-30 {
    font-size: 18px;
    font-weight: 600;
}

.signature {
    position: fixed;
    top: v-bind(top);
    left: v-bind(left);
    width: 100vh;
    height: 100vw;
    transform: rotate(90deg);
    background: #fff;
    transform-origin: center;
    display: flex;
    flex-direction: column;
    flex-flow: column-reverse;
    padding: 20px;
    z-index: 999;
}

.btn-area {
    position: absolute;
    top: 20px;
    right: 75px;
    display: flex;

    .btns {
        line-height: 44px;
        text-align: center;
        color: #fff;
        width: 111px;
        height: 44px;
        background: #209ee4;
        border-radius: 5px;

        &:nth-child(1) {
            margin-right: 20px;
            color: #f56c56;
            background: #f5f7fb;
            border: 1px solid #b3c0c8;
        }
    }
}

.back {
    position: absolute;
    top: 30px;
    left: 30px;
    display: flex;
    color: #333;
    font-size: 16px;
    display: flex;
    align-items: center;

    span {
        margin-left: 10px;
    }
}

.sign {
    display: flex;
    height: 70px;
    align-items: center;

    .start-sign {
        // color: #409eff;
        width: 173px;
        height: 30px;
        background: #f4f6f8;
        border-radius: 5px;
    }

    .sign-img {
        margin-left: 20px;
        width: 130px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
}

.party-a {
    // margin: 24px 0;
    margin-top: 24px;
    line-height: 26px;
    position: relative;

    img {
        width: 70px;
        position: absolute;
        left: 30%;
        top: -10%;
    }
}

.date {
    span {
        &:nth-child(2n) {
            text-decoration: underline;
            margin: 0 5px;
        }
    }
}

.sub-btn {
    width: 95%;
    height: 44px;
    background: #209ee4;
    border-radius: 5px;
    line-height: 44px;
    text-align: center;
    color: #fff;
    font-size: 14px;
    margin: 0 auto;
    margin-bottom: 10px;
    margin-top: 20px;

    span {
        font-size: 14px !important;
    }
}
</style>